package com.ellwood.common.core.result;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * @ProjectName: Ellwood-framework-boot
 * @PackageName: com.ellwood.common.core.result
 * @ClassName: PageResult
 * @Description: // 分页工具类
 * @Author: Ellwood
 * @CreateDate: 2024/7/24 - 上午9:40
 * @Version: V1.0.0
 */
@Data
@Schema(description = "分页工具类")
public class PageResult<T> implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "总记录数")
    private int total;

    @Schema(description = "列表数据")
    private List<T> result;

    /**
     * 分页
     *
     * @param result 列表数据
     * @param total  总记录数
     */
    public PageResult(List<T> result, long total) {
        this.result = result;
        this.total = (int) total;
    }
}
